﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using RazorBridge.Helpers;

namespace System.Web.Mvc.Html
{
    public static class MvcExtensions
    {
        public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string pluginKey, string partialViewName)
        {
            return htmlHelper.Partial(FrameworkUtility.CreateCombinedViewName(pluginKey, partialViewName));
        }

        public static MvcHtmlString Partial(this HtmlHelper htmlHelper, string pluginKey, string partialViewName, object model)
        {
            return htmlHelper.Partial(FrameworkUtility.CreateCombinedViewName(pluginKey, partialViewName), model);
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification="This is the acceptable nest of generic type")]
        public static MvcHtmlString EditorFor<TModel, TValue>(this HtmlHelper<TModel> html, string pluginKey, string templateName, Expression<Func<TModel, TValue>> expression)
        {
            return html.EditorFor<TModel, TValue>(expression, FrameworkUtility.CreateCombinedViewName(pluginKey, templateName));
        }
    }
}
